const express = require("express");
const expressJoi = require("../utils/express-joi");
const {
  reg_user_list_schema,
  reg_user_add_schema,
  reg_user_edit_schema,
  reg_user_delete_schema,
  reg_user_bindMenu_schema,
} = require("../schemas/userSchema");

const userController = require("../controllers/userController");

const router = express.Router();

router.post("/add", expressJoi(reg_user_add_schema), userController.addUser);

router.post("/edit", expressJoi(reg_user_edit_schema), userController.editUser);

router.delete(
  "/delete/:id",
  expressJoi(reg_user_delete_schema),
  userController.deleteUser
);
router.post(
  "/bindMenu",
  expressJoi(reg_user_bindMenu_schema),
  userController.bindMenu
);
router.get("/menu", userController.getUserMenu);

router.get(
  "/bindMenuInfo/:id",
  expressJoi(reg_user_delete_schema),
  userController.getBindMenuInfo
);

router.post(
  "/list",
  expressJoi(reg_user_list_schema),
  userController.getUserList
);

router.get("/select", userController.getUserSelect);

module.exports = router;
